﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using QDT.Common;
using QDT.Core.Domain;

namespace QDT.Web.Admin.Models
{
    public class AdminModel
    {
        [Required]
        public string Name { get; set; }

        [Required]
        public string Password { get; set; }

        [Required]
        public int RoleId { get; set; }

        public bool IsEffect { get; set; }

        public AdminUser ToEntity()
        {
            return new AdminUser(Name,Password)
                       {
                           RoleID = RoleId,
                           IsEffect = IsEffect
                       };
        }
    }

    public class EditAdminModel
    {
        public int ID { get; set; }

        public string Name { get; set; }

        public string Password { get; set; }

        [Required]
        public int RoleId { get; set; }

        public bool IsEffect { get; set; }
    }
}